<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<meta name="Description" content="工程师测试">

<script language='javascript' src="../js/jquery-2.1.1.min.js"></script>

<script language="JavaScript" src="../js/jquery.json.min.js"></script>

<link rel="stylesheet" type="text/css" href="../css/index.css">

<script type="text/javascript">

	function submitAnswerList() {
		
		var customerArray = new Array();
		customerArray.push({
			id : "1",
			answer : "Java EE",
			description : "B",
			exam_question_id : "B",
			answer_question_id : "1"
		});
		customerArray.push({
			id : "2",
			answer : "JDK",
			description : "B",
			exam_question_id : "B",
			answer_question_id : "1"
		});
		alert("ok");
		$.ajax({

			url : "/answer/submit",
			type : "POST",
			contentType : 'application/json;charset=utf-8', //设置请求头信息
			dataType : "json",
			//data : JSON.stringify(customerArray), //将Json对象序列化成Json字符串，JSON.stringify()原生态方法
			
			//data : $.toJSON(customerArray), //将Json对象序列化成Json字符串，toJSON()需要引用jquery.json.min.js
			data: {"customerArray":customerArray},
			success : function(data) {
				alert(data);
			},
			error : function(res) {
				alert(res.responseText);
			}
		});
	}
	
	
	 /* $("#confirmSample").bind("click", function () {
         var userCodeArr = new Array();
         $(".checkbox").each(function(){
             if ($(this).attr("checked")) {
                 userCodeArr.push($(this).val());
             }
         });
         if (userCodeArr.length == 0) {
             alert("请至少选择一条记录。");
             return;
         }
         var truthBeTold = window.confirm("确认抽样？");
         if (truthBeTold) {
             $("#confirmSample").val("确认ing");
             $.ajax({
                 type: "POST",
                 url: "/answer/submit",
                 data: {"userCodeArr":userCodeArr,"startdate":$("#start").val(),"enddate":$("#end").val()},
                 dataType: "json",
                 //contentType: "application/json;charset=utf-8",
                 success: function(data){
                     if (data.result == "success") {
                         alert("抽样确认成功");
                         var month = new Date().getMonth() + 1;
                         if (month < 10) {
                             month = "0"+month;
                         }
                         var strDate = new Date().getFullYear() + "-" + month + "-" + new Date().getDate();
                         $(".checkbox").each(function(){
                             if ($(this).attr("checked")) {
                                 var cd = $(this).parent().siblings("#chosen").text().split("-");
                                 if (cd.length != 3){
                                     $(this).parent().siblings("#chosen").html(strDate);
                                 }
                             }
                         });
                     } else {
                         alert("抽样确认失败");
                     }
                     $("#confirmSample").val("抽样确认");
                 }
             });
         }
     }); */
	
	
</script>

</head>
<body>

	<div class="quotes">
		<p>初遇时，她的微笑，她往日的深情、承诺和傻劲，两个人共度的美丽时刻，一一印在回忆里，今天的感情已经比不上从前，但是我爱着恋着往日的她，舍不得离开。</p>
		<div class="text5">记录・回忆</div>
		<div class="flower">
			<img src="../images/flower.jpg">
		</div>
	</div>
	<!--nav begin-->
	<div id="nav">
		<ul>
			<li><a href="/">首页</a></li>
			<li><a href="#">关于我</a></li>
			<li><a href="#">碎言碎语</a></li>
			<li><a href="#">慢生活</a></li>
			<li><a href="#">模板分享</a></li>
			<li><a href="#">永无止境</a></li>
			<li><a href="#">留言板</a></li>
		</ul>
	</div>

	<div class="photowall">
		<div class="theme-container" style="width: 60%; margin: 0 auto; background: #ffd1a4;">

			<form action="" method="post">
				<div>
					<div>一、填空</div>
					<c:forEach items="${fillingQuestionList}" var="a">
						<tr>
							<td>${a.id }、</td>
							<td>${a.content }</td>

							<td><input type="text" id=${a.id } name=${a.id } .answer style="width: 100px" /> <input type="text" name="${a.id }.description" value=${a.description } style="display: none" /> <input type="text" name="${a.id }.exam_question_id" value=${a.exam_question_id } style="display: none" /> <input type="text" name="${a.id }.answer_question_id" value=${a.id } style="display: none" /> <br> <br></td>
						</tr>
					</c:forEach>
				</div>
				<br />
				<div>
					<div>二、选择题</div>

					<c:forEach items="${choiceQuestionList}" var="a">
						<div>
							<a>${a.id }、</a> <a style="width: 90%;">${a.content }</a> <br /> <br /> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> ${a.choiceA }&nbsp; <input name=${a.id } .answer type="radio" value="A" /> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> ${a.choiceB }&nbsp; <input name=${a.id } .answer type="radio" value="B" /> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> ${a.choiceC }&nbsp; <input name=${a.id } .answer type="radio" value="C" /> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> ${a.choiceC }&nbsp; <input name=${a.id } .answer type="radio" value="D" /> <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
						</div>
						<br />

					</c:forEach>

				</div>
				<div>
				  <input type="submit" value="Submit">
					<input id="submit" type="button" value="提交" onclick="submitAnswerList()" style="width: 200px; margin: 0 auto; background: #ffdff4">
				</div>
			</form>
		</div>
	</div>

	<div class="blank"></div>


</body>
</html>
